<?php

/*

  Action – Duration	$5

  Discard your hand. If you discarded any cards this way,
  then at the start of your next turn, +5 Cards; +1 Buy; and +1 Action.

 */

class Tactician extends Card implements iAction, iKingdom, iDuration, iSeaside {

    public function __construct() {
        parent::__construct("Tactician", 5);
        $this->duration = 1;
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Discard your hand. If you discarded any cards this way,  then at the start of your next turn, +5 Cards; +1 Buy; and +1 Action.");
    }
    
    public function play(Game $game, $isRealCard) {
        $playhand = $game->getPlayHand();
        if (sizeof($playhand) > 0) {
             ScreenDisplay::addScreenMessage($game, true, "discard " . nicePrint($playhand), "discards " . sizeof($playhand) . " cards");
            $game->discardPlayHand();
            $game->pushCardToDurationAffects($this, 1, $isRealCard);
            $this->duration = 1;
        } else {
            $game->pushCardToDurationAffects($this, RETURN_DURATION_TO_DISCARD, $isRealCard);
            $this->duration = RETURN_DURATION_TO_DISCARD;
        }
		$game->cardActionFinished();
        return true;
    }

    public function cleanup(Game $game) {
        $game->moveCardFromPileToPile($this, PlayArea, DurationPileCards);
    }

    public function startTurn(Game $game, $quantity) {
        $drawed_cards = $game->drawCards(5);
        $game->addActions(1);
        $game->addBuys(1);
         ScreenDisplay::addScreenMessage($game, true, "activate ".  nicePrint($this)." and get +1 action, +1 buy and draw " . nicePrint($drawed_cards), "activates ".  nicePrint($this)." and get +1 action, +1 buy and draws " . sizeof($drawed_cards) . " cards");
        if ($quantity > 0)
            return RETURN_DURATION_TO_DISCARD;
        else
            return DELETE_VIRTUAL_DURATION_CARD;
    }

}

?>